package com.sengled.cloud.biz.union.mgt.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * 列表页检索参数(开始时间,结束时间,类型,页码标识)
 * Created by FMC on 2017/10/26.
 */
@Data
@ApiModel
public class ShopQueryParamsBean {

    @ApiModelProperty(position = 1,dataType = "String", value = "店铺ID")
    //@NonNull
    private String shopCode;
    
    @ApiModelProperty(position = 2,dataType = "String", value = "店铺名称")
    //@NonNull
    private String shopName;

    @ApiModelProperty(position = 3,dataType = "Long", value = "店铺属性  0全部 / 1直营 / 2加盟 ")
    //@NonNull
    private Integer shopNature;

    @ApiModelProperty(position = 4, dataType = "Long", value = "页面当前页码, 默认1")
    private Integer pageNo = 1;

    @ApiModelProperty(position = 5, dataType = "Long", value = "页面展示数量, 默认10")
    private Integer pageSize = 10;
    public Integer getPageSize(){
    	if(this.pageSize==null){
    		return 10;
    	}
    	return this.pageSize;
    }

    @ApiModelProperty(position = 6, hidden = true, dataType = "Long", value = "sql查询开始位置, 默认0")
    private Integer start = 0;
    
    public Integer getPageNo(){
    	if(this.pageNo==null){
    		return 1;
    	}
    	return this.pageNo;
    }

    public Integer getStart() {
    	if(this.pageNo==null){
    		return null;
    	}
        return (this.pageNo < 1) ? 0 : (this.pageNo - 1) * this.getPageSize();
    }

    private Long companyId;
    private Long userId;
    
    private boolean isSuperMgr;
}
